Adjusts the left and/or top margins of an image to a specified width. The margin may be defined as the distance from the edge of the page to the text on the page, or the distance from the edge of the page to the first straight line parallel to the edge. The margin may be increased or decreased in width. Any pixels added to the margin are white, ignoring the value of u.SF.PadColor.
This subcode differs from others in that the output image dimensions are unknown at the end of the REQ_INIT phase. Before the REQ_INIT phase, the output queue need not be allocated, but the Q_REVERSE flag should be set appropriately. The Put queue need not be allocated until the first RES_PUT_NEED_SPACE call which occurs in the REQ_EXEC phase. At this time, the output image dimensions are known and stored in RegionOut. The Put queue can be allocated at this time. After the REQ_EXEC phase, the value of OutputStride is set to reflect the dimensions of the output image.
The uncompressed image to be processed must reside in the Get Queue prior to REQ_EXEC. Typically, the image will be fully contained in the Get Queue, but that is not a requirement. The output image will be placed into the Put Queue during REQ_EXEC.
It is recommended that the image be deskewed before attempting registration.
Horizontal registration (adjusting the left margin) and vertical registration (adjusting the right margin) are controlled independently. In most respects these operations are totally isomorphic.
The number of columns or rows removed is stored after the REQ_EXEC phase in the entries u.SC24.HorizontalRegister.FeedbackLinesRemoved and u.SC24.HorizontalRegister.FeedbackLinesRemoved, respectively. Either of these values may be positive (indicating a reduction in the image dimensions) or negative (indicating an increase in the image dimensions). In the event that the AddOnly (see below) option is used for either vertical or horizontal registration, the values returned in u.SC24.HorizontalRegister.FeedbackLinesRemoved and u.SC24.HorizontalRegister.FeedbackLinesRemoved indicate the number of columns or rows that would have been removed if the AddOnly option were not used. The number of columns or rows actually removed can be determined by comparing the input and output image dimensions.
- Subcode is set to SF_SUBCODE_REGISTER (24).
- One or both of u.SC24.HorizontalRegister.Active and u.SC24.VerticalRegister.Active is set to true, indicating whether the image is to be registered horizontally, or vertically, or both. An error condition results if both parameters are set to false.
- u.SC24.HorizontalRegister.ResultantMargin and/or u.SC24.VerticalRegister.ResultantMargin are set as appropriate to specify the desired margin width after registration. Setting this value to 0 places text flush with the left or top edge of the image. A negative value crops the specified number of pixels from the left or top edge of the text. Valid values are -20000 (minimum) to +20000 (max).
- u.SC24.HorizontalRegister.MinBackground and/or u.SC24.VerticalRegister.MinBackground are set as appropriate to control sensitivity of the operation to edge noise. A suggested default value is 5. A higher value can cause the opcode to treat valid data as edge noise. A lower value can cause the opcode to treat edge noise as valid data. Valid values are 2 (minimum) to 1000 (max).
- u.SC24.HorizontalRegister.MinForeground and/or u.SC24.VerticalRegister.MinForeground are set as appropriate to control how much activity the opcode needs to see to consider it valid data. A recommended default value is 5. Individual characters are usually about 20 pixels wide, so values around 20 (on a 300 dpi image) often work well, consistently ignoring perpendicular lines. Lower values make the opcode more likely to register to edge noise. You may need to use values as low as 1 when you are dealing with dot matrix print. Valid values are 1 (minimum) to 1000 (max).
- u.SC24.HorizontalRegister.MinActivity and/or u.SC24.VerticalRegister.MinActivity are set as appropriate to control how intense the activity has to be for the opcode to consider it real activity. A recommended default value for this option is 3. Setting this value higher can improve performance when you find the program registering to edge noise. Valid values are 1 (minimum) to 1000 (max).
- u.SC24.HorizontalRegister.SkipActive and/or u.SC24.VerticalRegister.SkipActive may be set to true to skip a set number of rows or columns of the image before the opcode starts looking for valid information for registration. You can set and activate horizontal and vertical values separately. If one or both of these is set, then the number of columns or rows to skip is specified by u.SC24.HorizontalRegister.SkipDistance and/or u.SC24.VerticalRegister.SkipDistance, respectively.
- u.SC24.HorizontalRegister.CentralFocus and/or u.SC24.VerticalRegister.CentralFocus may be set to true to cause the opcode to ignore the top and bottom regions of the image for horizontal registration, or to ignore the left and right regions of the image for vertical registration. This option is useful for ignoring edge noise, letterheads, and logos.
- u.SC24.HorizontalRegister.IgnoreHoles may be set to true to cause the opcode to ignore binder holes and other left-edge noise when analyzing the left margin. The corresponding parameter u.SC24.VerticalRegister.IgnoreHoles has no effect.
- u.SC24.HorizontalRegister.ToLineActive and/or u.SC24.VerticalRegister.ToLineActive may be set to true to define the left margin by a vertical line or the top margin by a horizontal line, respectively. This is a powerful feature for precise registration on forms, especially on forms with edge noise. Instead of using what it believes to be the edge of the text, the opcode will position the text in the image based on the position of a vertical line (for horizontal registration) or a horizontal line (for vertical registration). This line should be significantly larger than any text characters (in particular, those characters to the left of this line). If no vertical/horizontal line is detected, the left/top margin will be unchanged. Valid values are true or false.
In Register.ToLine mode, the parameters MinBackground, MinForeground, MinActivity, CentralFocus, and IgnoreHoles described above have no effect. The parameters ToLineCheckThinLinesActive, ToLineMaxGap, ToLineMaxLineThickness, and ToLineMinLineLength described below have effect only in Register.ToLine mode.
- u.SC24.HorizontalRegister.ToLineMaxLineThickness and/or u.SC24.VerticalRegister.ToLineMaxLineThickness should be set if u.SC24.HorizontalRegister.ToLineActive or u.SC24.VerticalRegister.ToLineActive are set, respectively. The opcode scans across or down your image looking for lines. In some cases, especially with the Super-Line technology active, the opcode can mistake dense text for a line. This parameter lets you select the maximum thickness to consider when registering to a vertical line so you can set the maximum line thickness lower than the width of your text. You can activate and set the horizontal and vertical values separately. Valid values are 0 (minimum) to 100 (max). A recommended default value is 22.
- u.SC24.HorizontalRegister.ToLineMinLineLength and/or u.SC24.VerticalRegister.ToLineMinLineLength should be set if u.SC24.HorizontalRegister.ToLineActive or u.SC24.VerticalRegister.ToLineActive are set, respectively. Set this parameter to a value larger than the height of characters but less than the length of the line. The opcode will examine the image from left to right until it locates a vertical/horizontal line segment larger than the specified value or until it reaches one quarter the image width. It then shifts the image so that the line is the distance from the left edge of the image as specified by the value of ResultantMargin. Valid values are 0 (minimum) to 20000 (max). A recommended default value is 300.
- u.SC24.HorizontalRegister.ToLineCheckThinLinesActive and/or u.SC24.VerticalRegister.ToLineCheckThinLinesActive may be set to true if u.SC24.HorizontalRegister.ToLineActive or u.SC24.VerticalRegister.ToLineActive are set, respectively if the line you wish to register to is very thin (1 or 2 pixels). Valid values are true or false.
- u.SC24.HorizontalRegister.ToLineMaxLineGap and/or u.SC24.VerticalRegister.ToLineMaxLineGap may be set to true if u.SC24.HorizontalRegister.ToLineActive or u.SC24.VerticalRegister.ToLineActive are set, respectively. This property lets you invoke the Super-Line technology with the ToLine registration feature. With a value less than or equal to 3 the opcode simply ignores short gaps. However, setting this value over 3 tells the opcode to employ its Super-Line algorithms. These algorithms re-assemble broken lines into a whole line for registration purposes, and can dramatically improve the success rate with the ToLine registration feature. Valid values are 0 (minimum) to 50 (max).
In addition to placing an output image into the Put Queue, this operation stores some output information into the PIC_PARM structure in the following locations.
- BiOut is set, during REQ_EXEC, to the attributes of the output image.